]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
windowPreview: Add scaled extra size to chromeWidths() and chromeHeights
authorJonas Dreßler <verdre@v0yd.nl>
Mon, 8 Feb 2021 18:06:37 +0000 (19:06 +0100)
committerMarge Bot <marge-bot@gnome.org>
Fri, 19 Feb 2021 11:23:07 +0000 (11:23 +0000)
Right now the rowSpacing and columSpacing of the layout strategy is
calculated by looking at the overlapping sizes of the close button and
the app icon of the WindowPreview, plus a constant spacing read from CSS
by the WorkspaceLayout that's added to that. We're not factoring in the
extra size of the scaled-up WindowPreviews here and instead depend on
the constant spacing being large enough. If we don't want to depend on
the spacing here, we should add the scaled-up extra size to the sizes
returned by chromeWidths() and chromeHeights().

Since the last commits all previews scale up by the same amount of
pixels, so we can now just add that size to the values returned by
chromeWidths() and chromeHeights().

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1692>

js/ui/windowPreview.js
js/ui/workspace.js

index 25277894857b9f431ce0ea15c283a90d0e203fed..1659d0077548056865a89b41bec3c3106f050170 100644 (file)
@@ -466,15 +466,22 @@ var WindowPreview = GObject.registerClass({
     chromeHeights() {
         const [, closeButtonHeight] = this._closeButton.get_preferred_height(-1);
         const [, iconHeight] = this._icon.get_preferred_height(-1);
+        const { scaleFactor } = St.ThemeContext.get_for_stage(global.stage);
+        const activeExtraSize = WINDOW_ACTIVE_SIZE_INC * scaleFactor;
 
         const topOversize = closeButtonHeight / 2;
         const bottomOversize = (1 - ICON_OVERLAP) * iconHeight;
 
-        return [topOversize, bottomOversize];
+        return [
+            topOversize + activeExtraSize,
+            bottomOversize + activeExtraSize,
+        ];
     }
 
     chromeWidths() {
         const [, closeButtonWidth] = this._closeButton.get_preferred_width(-1);
+        const { scaleFactor } = St.ThemeContext.get_for_stage(global.stage);
+        const activeExtraSize = WINDOW_ACTIVE_SIZE_INC * scaleFactor;
 
         const leftOversize = this._closeButtonSide === St.Side.LEFT
             ? closeButtonWidth / 2
@@ -483,7 +490,10 @@ var WindowPreview = GObject.registerClass({
             ? 0
             : closeButtonWidth / 2;
 
-        return [leftOversize, rightOversize];
+        return [
+            leftOversize + activeExtraSize,
+            rightOversize  + activeExtraSize,
+        ];
     }
 
     showOverlay(animate) {
index e75d64377cb4e986917580471aa566c6469c8e39..403c5dded005988e5cae4e842c6b51fd18d8faaf 100644 (file)
@@ -12,7 +12,6 @@ const Util = imports.misc.util;
 const { WindowPreview } = imports.ui.windowPreview;
 
 var WINDOW_PREVIEW_MAXIMUM_SCALE = 0.95;
-var MAXIMUM_PREVIEW_AREA = 0.98;
 
 var WINDOW_REPOSITIONING_DELAY = 750;
 
@@ -470,14 +469,6 @@ var WorkspaceLayout = GObject.registerClass({
             colSpacing += Math.max(leftOversize, rightOversize);
 
         if (containerBox) {
-            // add some padding around preview area
-            const [width, height] = containerBox.get_size();
-            containerBox.set_size(
-                width * MAXIMUM_PREVIEW_AREA,
-                height * MAXIMUM_PREVIEW_AREA);
-            containerBox.x1 += width * (1 - MAXIMUM_PREVIEW_AREA) / 2;
-            containerBox.y1 += height * (1 - MAXIMUM_PREVIEW_AREA) / 2;
-
             const [topOverlap, bottomOverlap] = window.overlapHeights();
             containerBox.x1 += leftOversize + topOverlap;
             containerBox.x2 -= rightOversize;